🌴KapoeiraπŸ•ΊπŸ’ƒ

kapoeira

Kapoeira πŸ€” ?

Integration Tests

test pyramid

Kafka Stream

kafkalogo

Once upon a time

Enrich and collect data

enrichData

How to test ?

Fast and efficient…​

…​ But

  • it did not test the integration with the Kafka cluster

  • not a tool for QA, only for dev

  • how to test several streams ?

  • how to communicate with DEV/PO/QA ?

Need a tool similar to Karate

karate

  • HTTP-based APIs

  • simple syntax (Gherkin)

Birth of Kapoeira

2020

  • Inner tool

  • console-script confluent

202x ZIO

zio

2023 Open Source

kapoeira logo text

5 minutes inside Kapoeira

Cucumber Scala, using specific Gherkin DSL.

cucumber

5 minutes inside Kapoeira

kapoeira diagram

Syntaxe

TODO

DΓ©mo

buger quiz

Architecture

burger quiz

Docker commands

docker compose build --no-cache
docker compose up -d
docker restart kapoeira

burger.feature

Feature: Burger πŸ” feature

  Background:
    Given input topic
      | topic     | alias        | key_type | value_type |
      | bread     | bread-in     | string   | string     |
      | vegetable | vegetable-in | string   | string     |
      | meat      | meat-in      | string   | string     |
    And output topic
      | topic  | alias      | key_type | value_type | readTimeoutInSecond |
      | burger | burger-out | string   | string     | 5                   |
    And var uuid = call function: uuid

  Scenario: Nominal
    When records with key and value are sent
      | topic_alias  | key        | value |
      | bread-in     | 🀀_${uuid} | 🍞    |
      | vegetable-in | 🀀_${uuid} | πŸ…    |
      | meat-in      | 🀀_${uuid} | πŸ₯©    |
    Then expected records
      | topic_alias | key        | value |
      | burger-out  | 🀀_${uuid} | order |
    And assert order $ == "πŸ”"

  Scenario: Not a burger
    When records with key and value are sent
      | topic_alias  | key        | value |
      | bread-in     | 🀀_${uuid} | 🍞    |
      | vegetable-in | 🀀_${uuid} | πŸ₯•    |
      | meat-in      | 🀀_${uuid} | πŸ₯©    |
    Then expected records
      | topic_alias | key        | value |
      | burger-out  | 🀀_${uuid} | order |
    And assert order $ == "🍞 + πŸ₯• + πŸ₯©"

  Scenario Outline: Many customers
    When records with key and value are sent
      | topic_alias  | key            | value       |
      | bread-in     | <user>_${uuid} | <bread>     |
      | vegetable-in | <user>_${uuid} | <vegetable> |
      | meat-in      | <user>_${uuid} | <meat>      |
    Then expected records
      | topic_alias | key            | value |
      | burger-out  | <user>_${uuid} | order |
    And assert order $ == "<result>"

    Examples:
      | user | bread | vegetable | meat | result |
      | 🀀   | 🍞    | πŸ…        | πŸ₯©   | πŸ”     |
      | πŸ˜‹   | 🍞    | πŸ…        | πŸ—   | πŸ”     |
      | 😑   | 🍞    | πŸ…        | 🐟   | πŸ”     |

meal.feature

Feature: Meal πŸ› feature

  Background:
    Given input topic
      | topic       | alias          | key_type | value_type |
      | bread       | bread-in       | string   | string     |
      | vegetable   | vegetable-in   | string   | string     |
      | meat        | meat-in        | string   | string     |
      | side-dishes | side-dishes-in | string   | string     |
    And output topic
      | topic | alias    | key_type | value_type | readTimeoutInSecond |
      | meal  | meal-out | string   | string     | 20                  |
    And var uuid = call function: uuid

  Scenario: Left Join with Left first
    When records with key and value are sent
      | topic_alias    | key        | value |
      | bread-in       | 🀀_${uuid} | 🍞    |
      | vegetable-in   | 🀀_${uuid} | πŸ…    |
      | meat-in        | 🀀_${uuid} | πŸ₯©    |
      | side-dishes-in | 🀀_${uuid} | πŸ₯”πŸΊ  |
    Then expected records
      | topic_alias | key        | value |
      | meal-out    | 🀀_${uuid} | notif |
      | meal-out    | 🀀_${uuid} | order |
    And assert notif $ == "πŸ”"
    And assert order $ == "πŸ›(πŸ” + 🍟🍺)"

  Scenario: Left Join with Right first
    When records with key and value are sent
      | topic_alias    | key        | value |
      | side-dishes-in | 🀀_${uuid} | πŸ₯”πŸ·  |
      | bread-in       | 🀀_${uuid} | 🍞    |
      | vegetable-in   | 🀀_${uuid} | πŸ…    |
      | meat-in        | 🀀_${uuid} | πŸ₯©    |
    Then expected records
      | topic_alias | key        | value |
      | meal-out    | 🀀_${uuid} | order |
    And assert order $ == "πŸ›(πŸ” + 🍟🍷)"